
<!--
/**************************************************
* @ orderquery.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/16, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<%@page import="system.LoginContext"%>
<%@page import="framework.core.SrvContext"%>
<html>
<head>
<title>申购单查询</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<!--<LINK href="<%=root%>/css/css.css" type=text/css rel=stylesheet>-->
<LINK href="<%=root%>/css/caigouxitong.css"" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language=javascript src="<%=root%>/framework/js/datePicker/WdatePicker.js"></SCRIPT>
<%
ArrayList wareList = (ArrayList)request.getAttribute("orderdept");
	ResultProcess tOrder = (ResultProcess)request.getAttribute("order");
	ArrayList tList = new ArrayList();
	String [] tStr = null;
%>
<script>
	var counter;
	function process(val){
		if(val == 'Q'){
			var tStr = "";		
			var tEnd = "";				
			if(!isEmpty(orderqueryform.orderCreateDateStr.value)){
				tStr = orderqueryform.orderCreateDateStr.value.substr(0,4) + orderqueryform.orderCreateDateStr.value.substr(5,2) + orderqueryform.orderCreateDateStr.value.substr(8,2);
			}
			if(!isEmpty(orderqueryform.orderCreateDateEnd.value)){
				tEnd = orderqueryform.orderCreateDateEnd.value.substr(0,4) + orderqueryform.orderCreateDateEnd.value.substr(5,2) + orderqueryform.orderCreateDateEnd.value.substr(8,2);						
			}
			if(parseInt(tStr) > parseInt(tEnd)){
					alert("申购单要求送货周期的开始日期不能大于截止日期！");
					return false;
			}		
			orderqueryform.action = "<%=response.encodeURL(request.getContextPath()+"/A100402.do")%>" ;
    		orderqueryform.submit();			
		}else if(val == 'C'){
			orderqueryform.orderId.value ="";
			orderqueryform.orderDetailStatus.value="0000";			
			orderqueryform.orderDeptId.selectedIndex=0;
			orderqueryform.concentricityId.value = "";
			orderqueryform.manufInfo.value = "";
			orderqueryform.orderCreateDateStr.value = "";						
			orderqueryform.orderCreateDateEnd.value = "";
            orderqueryform.drawingpiececode.value = "";									
			return false;		
		}

	}
	
	function processExport(){
		orderqueryform.action = "<%=response.encodeURL(request.getContextPath()+"/A100405.do")%>" ;
		orderqueryform.submit();		
	}
</script>
</head>

<body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name=orderqueryform method="get" >
<p><br></p>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td height="20">
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
				<tr height="20">
					<td height="30" width="758" class="mtxt_black">申购信息综合查询
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="bg_line" height="2"></td>
	</tr>
</table>
<br>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center width="15%">申购单编号</TD>
					<TD align=left class="bg_row_odd" width="35%">
					<input type="text" name="orderId" value="<%=request.getParameter("orderId")==null? "":request.getParameter("orderId") %>" maxlength="20"></TD>					
					<TD class="bg_column" align=center width="15%">申购单明细状态</TD>
					<TD align=left class="bg_row_odd" width="35%">
						<select name="orderDetailStatus">					
						<option value="0000">---全部---</option>
						<%
							String tOrderDetailStatus = request.getParameter("orderDetailStatus");
							String[][] tDetailStatus = GSBaseManager.getAllOrderDetailStatusForOrder();
							if(tDetailStatus != null && tDetailStatus.length > 0 ){
								for(int i=0; i<tDetailStatus.length; i++){
									String[] temp = tDetailStatus[i];
									if(tOrderDetailStatus != null && tOrderDetailStatus.equals(temp[0])){
						%>
										<option value="<%=temp[0]%>" selected>
										<%=temp[1]%></option>
						<%				    
									}else{
						%>
										<option value="<%=temp[0]%>" >
										<%=temp[1]%></option>
						<%			
									}
								}
							}
						%>
						</select>
					</TD>	
				</TR>
				<TR height=20>							
					<TD class="bg_column" align=center>订货单位</TD>
					<TD left=right class="bg_row_odd">
						<select name="orderDeptId">					
						<option value="<%=LoginContext.get(new SrvContext(request,response)).getLoginWarehouseCode() %>">---全部---</option>
						<%
							String tOrderDept = request.getParameter("orderDeptId")==null?"":request.getParameter("orderDeptId");
							if(wareList != null && wareList.size() > 0 ){
									for(int i=0; i<wareList.size(); i++){
									    GSWareHouseBean tmp=(GSWareHouseBean)wareList.get(i);
										if(tmp != null && tOrderDept.equals(tmp.getCode())){
							%>
											<option value="<%=tmp.getCode()%>" selected>
											<%=tmp.getName()%></option>
							<%				    
										}else{
							%>
											<option value="<%=tmp.getCode()%>"><%=tmp.getName()%></option>
							<%			
										}
									}
							    }
						%>
						</select>
					</TD>
                    <td class="bg_column" align=center>图件号</td>
                    <td align=left class="bg_row_odd" >
                    <input type="text" name="drawingpiececode" value="<%=request.getParameter("drawingpiececode")==null?"":request.getParameter("drawingpiececode") %>">
                    </td> 					
				</TR>				
				<TR height=20>
					<TD class="bg_column" align=center>集中编码</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<input type="text" name="concentricityId" maxlength="20" value="<%=request.getParameter("concentricityId")==null?"":request.getParameter("concentricityId")%>">
					</TD>
				</TR>									
				<TR height=20>
					<TD class="bg_column" align=center>产品信息</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<input type="text" name="manufInfo" maxlength="200" value="<%=request.getParameter("manufInfo")==null?"":request.getParameter("manufInfo")%>">（<FONT color="#ff0033">对产品名称、型号、规格、品牌、生产厂商、附加属性等关键字的模糊查询</FONT>）&nbsp;
					</TD>
				</TR>
                <%
                SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                Date d = new Date();
                String strNow = String.valueOf(bartDateFormat.format(d));
                long l=(long)259200*(long)10000;
                Date d2 = new Date(System.currentTimeMillis()-l);
                String strMothAgo = String.valueOf(bartDateFormat.format(d2));
                
                %>          									
				<TR height=20>	
					<TD class="bg_column" align=center>要求送货时间</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<%=framework.custom.UIManager.generateDateInput("orderCreateDateStr",
							request.getParameter("orderCreateDateStr")==null?strMothAgo:request.getParameter("orderCreateDateStr"))%>
					
					至
					<%=framework.custom.UIManager.generateDateInput("orderCreateDateEnd",
							request.getParameter("orderCreateDateEnd")==null?strNow:request.getParameter("orderCreateDateEnd"))%>
					
					</TD>
				</TR>
                        <%
                        if(tOrder != null) {
                            int totalRecords = 0;
                            if(request.getAttribute("totalRecords")!=null){
                                totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                            }
                            int defaultPageSize =10;
                            if(request.getAttribute("pageSize")!=null){
                                defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                            }
                        %>          
                        <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
                        <%} %>
			</table>
		</td>
	</tr>
</table>
</form>
    <p align="center">  
<!--		<input type="image" src="< %=root%>/images/button/chaxun.gif" width="58" height="24" class="box" onclick="process('Q')"/>&nbsp;-->
<!--		<input type="image" src="< %=root%>/images/button/clean.gif" width="58" height="24" class="box" onclick="process('C')"/>&nbsp;				-->
		<input type="button" name="查询" value="查询" class="kuang" onclick="process('Q')"/>&nbsp;
		<input type="button" name="清空" value="清空" class="kuang" onclick="process('C')"/>&nbsp;	
		<input type="button" name="导出" value="导出" class="kuang" onclick="processExport()"/>&nbsp;
    </p>
<%
	
	if(tOrder != null){
%>
	<center>
    <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20>
                        <td class=top align=middle colspan="16"> 
                        <div align="center" class="txt_content"><b>申购单信息列表</b>
                    	  </div>
						</td>					
					</tr> 
                    <tr class="bg_column" height=20> 
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">申购单明细编号</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">集中编码</div>
						</td>						
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品名称</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">供应商</div>
						</td>						
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">规格</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">型号</div>
						</td>																																				
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">品牌</div>
						</td>
                        <td class=top align=center> 
                        <div align="center" class="txt_content">图件号</div>
                        </td>										
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">订货数量</div>
						</td>											
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">申购单明细状态</div>
						</td>																	
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">要求送货时间</div>
						</td>										
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">订货单位</div>
						</td>
                        										
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">价格（元）</div>
						</td>										
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">总价（元）</div>
						</td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">结算模式</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">详细信息</div>
						</td>																																				
					</tr>
					<%
						tList = tOrder.getAllRecoreds();
						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							GSOrderAnaDetailBean temp=(GSOrderAnaDetailBean)tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}
					%>
							<tr <%=tTempStr%> height=20>
								<td class=top align=middle> 								
									<div align="center" class="txt_content">
									<%=temp.getGs_order_detail_id()%>
									</div>
								</td>	
								<td class=top align=middle> 								
									<div align="center" class="txt_content">
									<%=temp.getConcentricity_code()%>
									</div>
								</td>														
								<td class=top align=middle > 								
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root + "/A100404.do?&concentricityId="+temp.getConcentricity_code())%>" target="_blank"><%=temp.getName_product()%></a>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root + "/A150504.do?&providerId="+temp.getCode())%>" target="_blank"><%=temp.getName()%></a>
									</div>
								</td>												
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=temp.getSpec()%>
									</div>
								</td>				
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=temp.getModel()%>
									</div>
								</td>													
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=temp.getProduct_brand()%>
									</div>
								</td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=temp.getDrawing_piece_code()%>
                                    </div>
                                </td> 
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=StringUtils.formatEDouble(temp.getGs_order_count(),2)+temp.getProduct_unit()%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=GSBaseManager.getOrderDetailStatusName(temp.getGs_order_detail_status())%>
									</div>
								</td>								
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=temp.getGs_deliver_goods_date()%>
									</div>
								</td>															
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=temp.getName_warehouse()%>
									</div>
								</td>
                                  
                               																
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=StringUtils.formatEDouble(temp.getGs_goods_unitprice(),4)%>
									</div>
								</td>	
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<%=StringUtils.formatEDouble(temp.getGs_order_count()*temp.getGs_goods_unitprice(),4)%>
									</div>
								</td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=DefineDic.getBalanceMode(temp.getGs_balance_mode())%>
                                    </div>
                                </td>						
								<td class=top align=middle> 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root + "/A101003.do?orderId="+temp.getGs_order_tempid_order())%>&orderDetailId=<%=temp.getGs_order_detail_id()%>" target="_blank">详细</a>
									</div>
								</td>																																								
							</tr> 
					<%
						}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="16" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm='orderqueryform'/>
						    </td>
						  </tr>					
				    <%
						}else{
					%>     
                           <tr class="bg_column" height=20>
                            <td width="960" height="16" colspan="16" align="center">
                                    
                                    <font color="red">没有符合条件的申购单信息</font>
                            </td>
                          </tr> 
							
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
<%		
	}
%>

</body>
</html>